home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 21 / CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso / CUCD / Utilities / PGP / source / pgp50i-b8a / tools / subst.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-04  |  2.1 KB  |  65 lines

  1. /*
  2.  * subst.h -- Header for repair substitutions
  3.  *
  4.  * Copyright (C) 1997 Pretty Good Privacy, Inc.
  5.  *
  6.  * Written by Colin Plumb
  7.  *
  8.  * $Id: subst.h,v 1.1 1997/07/07 21:26:40 colin Exp $
  9.  *
  10.  * NOTE: Other weights are hiding in the TabFilter function.
  11.  * Remember to keep them all on the same scale.
  12.  */
  13.  
  14. /* Do not back up more than this many characters */
  15. #define MAX_BACK_CHARS 160
  16.  
  17. /*
  18.  * Do not back up more than this many points.
  19.  * The work attempted is *exponential* in this value, so don't raise it
  20.  * too high unless you have both memory and patience to spare.
  21.  */
  22. #define MAX_BACK_COST  50
  23.  
  24. /*
  25.  * There is a hack in the code to find a single substitution that will fix a
  26.  * line, even if it's not in the tables.  It gets added to the tables "on
  27.  * probation", and if it leads to a successful correction of the entire
  28.  * page, is "learned" for future use.  (This is not remembered across
  29.  * runs of the program, though.  Edit the tables in the source to fix it.)
  30.  */
  31. /* Cost of the a newly created substitution, "on probation" */
  32. #define DYNAMIC_COST_GUESSED 20
  33. /* Cost after it has been verified as useful. */
  34. #define DYNAMIC_COST_LEARNED 10
  35.  
  36. /*
  37.  * This negative-cost bonus for passing the end of a line with the right
  38.  * CRC makes the search engine reluctant to backtrack past a correct CRC,
  39.  * greatly improving efficiency.  It's rather a hack, though.  Think of
  40.  * this in terms of "how many errors should be considered in the current
  41.  * line before considering the possibility of errors in the previous line?"
  42.  */
  43. #define COST_LINE -30
  44.  
  45. /* Type describing filter functions used in substitutions */
  46. struct ParseNode;
  47. struct Heap;
  48. struct Substitution;
  49. #include "heap.h"
  50. typedef HeapCost FilterFunc(struct ParseNode *parent, char const *limit,
  51.     struct Substitution const *subst);
  52. FilterFunc TabFilter;    /* The one filter func that we use */
  53.  
  54. /* The external substitution format */
  55. typedef struct RawSubst {
  56.     char const *input;
  57.     char const *output;
  58.     HeapCost cost;
  59.     FilterFunc *filter;
  60. } RawSubst;
  61.  
  62. /* The substitutions to make */
  63. extern struct RawSubst const substSingles[];
  64. extern struct RawSubst const substMultiples[];
  65.